home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-02-04 | 6.6 KB | 163 lines | [TEXT/R*ch] |
- Send Script Version 1.0.1 -- Extension for BBEdit 2.2 or Later
- ==============================================================
-
- • Legal Stuff
-
- Copyright © 1993 Ed Watkeys (edw@distant.uucp or edw%distant@bts.com)
- This software may be copied freely, provided that the documentation (this
- file) is retained, and that you do not profit monetarily from its further
- distribution. It may, however, be distributed by bulletin board systems
- and on-line information services. If you would like to distribute Send
- Script in any sort of software collection, you must contact me and get my
- permission before doing so.
-
- You are under no legal or moral obligation to pay anything for this
- software, however, I'm not going to stop you if you want to. Comments and
- suggestions, however, are encouraged.
-
- I've stopped distributing the source code along with the extension, as I
- imagine most people don't really care about it. If you would like the
- source code, simply send a letter to "sendscript-source@distant.uucp" or
- "sendscript-source%distant@bts.com" -- the source will automatically be
- sent to you. By the way, I wrote Send Script in THINK C 5.0.
-
- Edwin H. Watkeys III
- 1616 Upper State Road
- North Wales, PA 19454
-
- • Instructions
-
- Send Script simply allows you to use BBEdit to write and send scripts to
- other programs via the do-script Apple event. Examples of programs which
- accept scripts are FileMaker Pro, UserLand Frontier, StuffIt Deluxe, the
- Alpha text editor, Tim Endre's TCL implementation for the Macintosh,
- tickle, and of course, HyperCard 2.1. Note: you will have problems sending
- scripts to Alpha and StuffIt Deluxe unless you have versions 5.3 and 3.0.5,
- respectively.
-
- Before you send a script, you'll need a script to send. All of the
- examples I give will be for UserLand Frontier -- that's what I used for
- testing.
-
- If you select "Send Script…" without a selection, Send Script will assume
- you want the entire current document sent. Otherwise, Send Script will
- send only the text you have selected.
-
- Tip: Make sure you press the return key after the end of yor script, and
- select the return character, too. Results are inserted immediately after
- the script, and will be begin on the same line as your script if you don't
- make a carriage return the last character in your script.
-
- Here's a sample UserLand Frontier script:
-
- message = "This is a test" + char(13);
- message = message + "of Send Script." + char(13);
- return(message);
-
- Select it, and choose "Send Script…" from the Extensions menu. You will be
- confronted with a dialog box. Here's a list of the items, along with their
- purposes:
-
- 1. "Select Target…" -- click here to bring up a browser which allows you
- select which application will receive your script. Your selection is
- saved in Send Script's preferences, so that you don't need to change
- do this except when you want to change your target.
-
- 2. "Put Results in New Document" -- check this if you want the results of
- your script to appear in a new document. Otherwise, they will appear
- immediately after the script you selected. This item's default state is
- determined by wether or not you selected anything in the current
- document -- if you did, Send Script will by default insert the results
- in the original document. If you didn't, it'll will by default put the
- results in a new document. Because of this, your selection is not saved
- in Send Script's preferences.
-
- 3. "Timeout" -- these radio buttons allow you to tell Send Script how long
- to wait for a reply to your script. If the timeout runs out, it'll stop
- waiting for a reply and will exit. The default timeout is about a
- minute. A reason to change this is if your script requires user
- interaction, and you don't know how long it will take for the user to
- make his/her decision. I'm not sure what you'd want no timeout for, but
- put it there for the sake of completeness. This option is saved in Send
- Script's preferences.
-
- 4. "OK" and "Cancel" -- click on "Cancel" and we'll forget any of this
- ever happened. Click on "OK", and Send Script will go ahead and send
- your script. The watch cursor comes up, and you will wait, unless you
- press command-period to cancel the script, in which case you return to
- BBEdit. The "OK" button will be unavailable if there is no currently
- selected target. Just because the "OK" button is available, it doesn't
- mean you have a valid target, so unless you know what it is, it might
- be a good idea to check. In practice, the only times that "OK" will be
- unavailable is the first time you run Send Script with a new copy of
- BBEdit, or if you throw away the BBEdit Preferences file.
-
- The above descriptions should give you a pretty good idea of how to use
- Send Script.
-
- • Notes for Frontier Users
-
- If you execute the following script from BBEdit:
-
- msg("Have a nice day.");
-
- You will find that it returns "true". It'll put a message in Frontier's
- message window, but that might not be what you were thinking of. If you
- want to turn BBEdit into your "standard out", you're going to need to do
- something else. I suggest you create an item in the object database called
- "stdout" and write your scripts like this:
-
- on WriteLn(message)
- {
- people.edw.stdout = people.edw.stdout + string(message) + char(13);
- };
-
- on Write(message)
- {
- people.edw.stdout = people.edw.stdout + string(message);
- };
-
- on InitStdout()
- {
- people.edw.stdout = "";
- };
-
- InitStdout();
- WriteLn("Hello, my name is Ed.");
- WriteLn("What is your name?");
- return(people.edw.stdout);
-
- The above example will return the following:
-
- Hello, my name is Ed.
- What is your name?
-
- So, you see, there isn't a lot to it. Don't forget to put your own
- "initials" where "edw" is. This isn't the only way to do it, it's just one
- that I usually use because it makes using Frontier scripts more natural
- from BBEdit. You can put the above routines in your own "home" table if
- you wish -- I just did it this way to show you how I do it.
-
- • Misc. Stuff
-
- I hope you enjoy Send Script. If you have found any novel uses for it or
- you hate something about it that you'd like me to change, feel free to
- tell me.
-
- I'm not really sure about what you can actually use Send Script for. I
- wrote it because I thought it was a cool idea, not because I had a use for
- it. When you think about it, using BBEdit to send scripts to Frontier
- makes little if any sense!
-
- Let me know if there are any other BBEdit Extensions you'd like to see --
- I'll consider writing any which aren't insanely boring. Don't know what
- I'd call boring, so I you'll have to ask me about anything you have in
- mind.
-
- • Changes Since Version 1.0
-
- 1.0.1: Fixed all known bugs in 1.0.
- Changed documentation a bit.
- Send Script won't get upset if there is neither a direct object
- nor an error string in the reply Apple event.
-